﻿@{
    ViewBag.Title = "Deposit/Withdraw";
    Layout = "~/Views/Shared/_Transfer_Menu.cshtml";
}
<h2>
    Deposit / Withdraw</h2>
<div>
    @Html.Partial("_Cards")
    <div style="margin: 10px">
     <a href="#" id ="delete_link">Delete Card</a>
        <span>
            <button class="invisible" id="blockCard">
                Lock</button>
        </span>
        <span>
            <button class="invisible" id="unblockCard">
                Unlock</button>
        </span>
       
    </div>
</div>
@section cardsScript {
    <script type="text/javascript" src="@Url.Content("~/Scripts/cards.js")"></script>
    <script type="text/javascript">
        $(function() {
            
            var rowClickHandler = function () {
                $("#amountMenuItem").removeClass('invisible');
                $(".selected").toggleClass("selected");
                $(this).toggleClass("selected");
                $("#cardNumber").attr("value", $(".selected").find("td:first").text());
                $("#delete_link").attr("href", "/Card/Delete?cardNumber=" + $("#cardNumber").val() + "&redirect=" + location.href);
                $("#delete_link").click(function() {
                    if (confirm("Do you really want to delete the card?"))
                        return true;
                    return false;
                });
                modifyCardButtons();
            };

            $('tbody tr.row').live('hover', function () {
                $(this).toggleClass('clickable');
            }).live('click', rowClickHandler);
            
            @{
                if (ViewBag.SelectedCardIndex != 0)
                {
                    @:$($("tbody tr.row").get(@ViewBag.SelectedCardIndex)).addClass("selected");
                    @:rowClickHandler();
                }
            }
         });
        
    </script>
}
